<?php defined('BASEPATH') or exit('No direct script access allowed');

class Module_Message extends Module {

	public $version = 1.0;

	public function info()
	{
		return array(
			'name' => array(
				'es' => 'Escort Message es',
				'en' => 'Escort Message'
			),
			'description' => array(
				'es' => 'Escort Message Management',
				'en' => 'Escort Message Management'
				),
			'frontend' => TRUE,
			'backend' => TRUE,
			'skip_xss'	=> TRUE,
			'menu'		=> '1escort_message',
			'sections' => array(
			    'message' => array(
				    'name' => 'escort_thread_title',
				    'uri' => 'admin/message',
				    'shortcuts' => array(
						array(
					 	   'name' => 'escort_thread_create_title',
						    'uri' => 'admin/message/create',
						    'class' => 'add'
						),
					),
				),
			),
		);
	}

	public function install()
	{
		$this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('escort_messages')." (
  				 `id` INT NOT NULL AUTO_INCREMENT ,
				  `sender` VARCHAR(45) NULL ,
				  `sent_time` INT NULL ,
				  `message` TINYTEXT NULL ,
				  `read` INT NULL ,
				  `thread_id` INT NULL ,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
		return $this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('escort_message_threads')." (
  				`id` INT NOT NULL AUTO_INCREMENT ,
				  `origin` VARCHAR(45) NULL ,
				  `owner` VARCHAR(255) NULL ,
				  `solver_permission_slug` VARCHAR(45) NULL ,
				  `created_time` INT NULL ,
				  `status` VARCHAR(45) NULL ,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
	}

	public function uninstall()
	{
		return TRUE;
	}

	public function upgrade($old_version)
	{
		// Your Upgrade Logic
		return TRUE;
	}

	public function help()
	{
		// Return a string containing help info
		// You could include a file and return it here.
		return "This module has no inline docs as it does not have a back-end.";
	}
}
/* End of file details.php */